#include "iostream"
#include "cuda.h"
#include "cuda_runtime.h"
//kernel函数
__global__ void gpuAdd(int d_a,int d_b, int *d_c){
    *d_c = d_a + d_b;
}

int main(void)
{
    int h_c;
    int *d_c;
    cudaMalloc((void**)&d_c, sizeof(int));
    gpuAdd<<<1,1>>>(1,4 ,d_c);
    cudaMemcpy(&h_c, d_c,sizeof(int),cudaMemcpyDeviceToHost);
    printf("%d", h_c);
    cudaFree(d_c);
    return 0;
}